# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1SearchDocumentsResponseMatchingDocument do
  @moduledoc """
  Document entry with metadata inside SearchDocumentsResponse

  ## Attributes

  *   `document` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Document.t`, *default:* `nil`) - Document that matches the specified SearchDocumentsRequest. This document only contains indexed metadata information.
  *   `matchedTokenPageIndices` (*type:* `list(String.t)`, *default:* `nil`) - Return the 1-based page indices where those pages have one or more matched tokens.
  *   `qaResult` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1QAResult.t`, *default:* `nil`) - Experimental. Additional result info if the question-answering feature is enabled.
  *   `searchTextSnippet` (*type:* `String.t`, *default:* `nil`) - Contains snippets of text from the document full raw text that most closely match a search query's keywords, if available. All HTML tags in the original fields are stripped when returned in this field, and matching query keywords are enclosed in HTML bold tags. If the question-answering feature is enabled, this field will instead contain a snippet that answers the user's natural-language query. No HTML bold tags will be present, and highlights in the answer snippet can be found in QAResult.highlights.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :document =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Document.t() | nil,
          :matchedTokenPageIndices => list(String.t()) | nil,
          :qaResult =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1QAResult.t() | nil,
          :searchTextSnippet => String.t() | nil
        }

  field(:document, as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Document)
  field(:matchedTokenPageIndices, type: :list)
  field(:qaResult, as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1QAResult)
  field(:searchTextSnippet)
end

defimpl Poison.Decoder,
  for:
    GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1SearchDocumentsResponseMatchingDocument do
  def decode(value, options) do
    GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1SearchDocumentsResponseMatchingDocument.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for:
    GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1SearchDocumentsResponseMatchingDocument do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
